package com.movie.enums;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

import java.util.Objects;

/**
 * @author Liu Jiaquan
 * @Description
 * @date 2024/8/3 18:16
 */
@Getter
@AllArgsConstructor
public enum OrderStatus {
    PAID(1, "已支付"),
    UNPAID(2, "未支付"),
    REFUND(3, "已退款");
    private final Integer status;
    private final String text;

    public static OrderStatus getOrderEnum(Integer status) {
        OrderStatus[] values = OrderStatus.values();
        for (OrderStatus orderStatus : values) {
            if (Objects.equals(orderStatus.getStatus(), status)) {
                return orderStatus;
            }
        }
        return null;
    }
}
